<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>绝对定位</title>
    <style>
        #outer{
            width: 100px;
            height: 50px;
            background-color: red;
            padding-left: 10px;
            box-sizing: border-box;
        } 
        .box{
            position: absolute;
            background-color: gold;
            top:20px;
            width: 10px;
            height: 10px;
            display: inline-block;
            right: 20px;
        }
    </style>
</head>
<body>
    <div id="outer">
        <span>文字</span><div class="box"></div>
    </div>
    
</body>
</html>